<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
	<title>Assign/UnAssign Course </title>
</h:head>
<f:view>
	<h:body>
		<ui:composition template="../includes/template.xhtml">
			<ui:define name="mainbody">
				<center>
					<h:form>


						<p:panel header="Assign/UnAssign Course" style="min-height: 550px"
							styleClass="prime_panel">
							<p:growl id="growl" showDetail="true" sticky="false"
								autoUpdate="true" showSummary="false" />
							<center>

								<table border="0" cellpadding="4px" cellspacing="8px">

								
								     <tr>
                                        <td><h:outputText value="Select Teacher :" /><h:outputText value="*" style="color:red"/></td>
                                        <td>
										<p:autoComplete
											style="width:250"  maxResults="5"
										 value="#{assignCourseBean.selectedTeacher}" id="teacher"
											completeMethod="#{assignCourseBean.completeTeacher}" 
											var="t" itemLabel="#{t.name} #{t.email}" itemValue="#{t}"
											converter="#{assignCourseBean.teacherConverter}"
											forceSelection="true"  required="true" requiredMessage="Please Select required Teacher"/>
										</td>
                                    </tr>
								
								
									<tr>
										<td><h:outputLabel>Assign Courses:</h:outputLabel> <h:outputText
												value="*" style="color:red" /></td>
									</tr>

									<tr>
										<td />
										<td colspan="3"><p:pickList id="coursesList"
												value="#{assignCourseBean.courses}" var="course" iconOnly="true"
												itemValue="#{course}" converter="courseConverter"
												required="true"
												requiredMessage="Please enter at least 1 course">

												<f:facet name="sourceCaption">All Courses</f:facet>
												<f:facet name="targetCaption">Assigned Courses</f:facet>

												<p:column>
										           #{course.title}
										        </p:column>

											</p:pickList>
										</td>
									</tr>
									<tr>
										<td></td>
										<td></td>
										<td></td>
										<td style="text-align: center"><p:spacer width="25" /> <p:commandButton
												ajax="false" id="submit" width="30" value="Submit"
												type="submit" action="#{assignCourseBean.perform}" />
										</td>
									</tr>
								</table>
							</center>
						</p:panel>
					</h:form>
				</center>
			</ui:define>
		</ui:composition>
	</h:body>
</f:view>
</html>
